﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.ComponentModel;

namespace WPFEdit.ViewModels
{
    public abstract class TabItem : INotifyPropertyChanged
    {
        private string m_tabName;
        private ICommand m_closeCommand;
        private bool m_isSelected;

        public bool IsSelected
        {
            get { return m_isSelected; }
            set { if (m_isSelected != value) { m_isSelected = value; OnPropertyChanged("IsSelected"); } }
        }

        public virtual string TabName
        {
            get { return m_tabName; }
            set
            {
                if (m_tabName != value)
                {
                    m_tabName = value;
                    OnPropertyChanged("TabName");
                }
            }
        }

        public abstract object TabContent
        {
            get;
            set;
        }

        public virtual ICommand CloseCommand
        {
            get { return m_closeCommand; }
            set
            {
                if (m_closeCommand != value)
                {
                    m_closeCommand = value;
                    OnPropertyChanged("CloseCommand");
                }
            }
        }

        protected void OnPropertyChanged(string propName)
        {
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propName));
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
